package com.future.enable;

import com.future.anno.AsyncHandler;
import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.core.annotation.AnnotatedElementUtils;

import java.lang.reflect.Method;

/**
 * 这里决定了切入点，代码表示了当方法被注解@标注了就是匹配到了切入点
 * StaticMethodMatcherPointcut 切入点的实现类：
 */
public class AsyncPointcut extends StaticMethodMatcherPointcut {

    @Override
    public boolean matches(Method method, Class<?> aClass) {
        return AnnotatedElementUtils.hasAnnotation(method, AsyncHandler.class);
    }
}
